ipTinyMceConfigPastePreprocess = function(pl, o, allowedClasses) {
var tmpContent = o.content;
/* replace strong with bold */
tmpContent = tmpContent.replace(/()/ig, "");
tmpContent = tmpContent.replace(/(<\/strong>)/ig, "");
/* replace h1 h2 h3 with bold */
tmpContent = tmpContent.replace(/(<(\ )*h[123][^<>]*>)/ig, "");
tmpContent = tmpContent.replace(/(<(\ )*\/h[123](\ )*>)/ig, "");
/* remove unknown classes */
var pattern = /<[^<>]+class="[^"]+"[^<>]*>/gi; /* find all tags containing classes */
var matches = tmpContent.match(pattern);
for ( var i = 0; matches && i < matches.length; i++) { /* loop through found tags */
var pattern2 = /class="[^"]+"/gi; /* find class name */
var matches2 = matches[i].match(pattern2);
for ( var i2 = 0; matches2 && i2 < matches2.length; i2++) { /* throw away unknown classes */
var classExist = false;
for ( var classKey = 0; classKey < allowedClasses.length; classKey++) {
if ('class="' + allowedClasses[classKey] + '"' == matches2[i2]) {
classExist = true;
}
}
if (!classExist) {
tmpContent = tmpContent.replace(matches2[i2], "");
}
}
}
o.content = tmpContent;
};
ipTinyMceConfigMin = {
// Location of TinyMCE script
script_url : ip.baseUrl + ip.libraryDir + 'js/tiny_mce/tiny_mce.js',
language: 'sl',
theme : "advanced",
plugins : "paste,inlinepopups,iplink,simplebrowser,advhr,advimage,table",
entity_encoding : "raw",
theme_advanced_buttons1 : "copy,paste,pastetext,separator,justifyleft,justifycenter,justifyright,separator,undo,redo,separator",
theme_advanced_buttons2 : "bold,italic,underline,styleselect,image,code",
theme_advanced_buttons3 : "bullist,numlist,outdent,indent,link,unlink,sub,sup",
theme_advanced_buttons4 : "tablecontrols",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
valid_elements : "@[class|style],img[class|src|alt|title|hspace|vspace|width|height|align|name],strong,em,br,sup,sub,p,span,b,u,i,a[name|href|target|title],ul,ol,li,table,tbody,thead,th,tr,td[colspan|rowspan]",
height : 300,
width : '100%',
content_css : ip.baseUrl + ip.themeDir + ip.theme + "/ip_content.css",
theme_advanced_styles : "Text=;Caption=caption;Signature=signature;Note=note",
forced_root_block : "p",
file_browser_callback : "simplebrowser_browse",
document_base_url : ip.baseUrl,
remove_script_host : false,
relative_urls : false,
convert_urls : true,
paste_auto_cleanup_on_paste : true,
paste_retain_style_properties : "",
paste_strip_class_attributes : true,
paste_remove_spans : false,
paste_remove_styles : true,
paste_convert_middot_lists : true,
paste_text_use_dialog : true,
paste_preprocess : function(pl, o) {
ipTinyMceConfigPastePreprocess(pl, o, new Array('caption', 'signature', 'note'));
}
};ipTinyMceConfigMed = {
// Location of TinyMCE script
script_url : ip.baseUrl + ip.libraryDir + 'js/tiny_mce/tiny_mce.js',
language: 'sl',
theme : "advanced",
plugins : "paste,inlinepopups,iplink,simplebrowser,advhr,advimage,table",
entity_encoding : "raw",
theme_advanced_buttons1 : "copy,paste,pastetext,separator,justifyleft,justifycenter,justifyright,separator,undo,redo,separator",
theme_advanced_buttons2 : "bold,italic,underline,styleselect,image,code",
theme_advanced_buttons3 : "bullist,numlist,outdent,indent,link,unlink,sub,sup",
theme_advanced_buttons4 : "tablecontrols",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
valid_elements : "@[class|style],img[class|src|alt|title|hspace|vspace|width|height|align|name],strong,em,br,sup,sub,p,span,b,u,i,a[name|href|target|title],ul,ol,li,table,tbody,thead,th,tr,td[colspan|rowspan]",
height : 300,
width : '100%',
content_css : ip.baseUrl + ip.themeDir + ip.theme + "/ip_content.css",
theme_advanced_styles : "Text=;Caption=caption;Signature=signature;Note=note",
forced_root_block : "p",
file_browser_callback : "simplebrowser_browse",
document_base_url : ip.baseUrl,
remove_script_host : false,
relative_urls : false,
convert_urls : true,
paste_auto_cleanup_on_paste : true,
paste_retain_style_properties : "",
paste_strip_class_attributes : true,
paste_remove_spans : false,
paste_remove_styles : true,
paste_convert_middot_lists : true,
paste_text_use_dialog : true,
paste_preprocess : function(pl, o) {
ipTinyMceConfigPastePreprocess(pl, o, new Array('caption', 'signature', 'note'));
}
};ipTinyMceConfigMax = {
// Location of TinyMCE script
script_url : ip.baseUrl + ip.libraryDir + 'js/tiny_mce/tiny_mce.js',
language: "sl",
theme : "advanced",
entity_encoding : "raw",
plugins : "iplink,paste,safari,spellchecker,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,inlinepopups,media,contextmenu,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,simplebrowser,advhr",
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,pastetext,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media",
theme_advanced_buttons4 : "insertlayer|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,blockquote,|,insertfile,insertimage,strikethrough,fullscreen",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
height : 300,
width : '100%',
content_css : ip.baseUrl + ip.themeDir + ip.theme + "/ip_content.css",
theme_advanced_styles : "Text=;Caption=caption;Signature=signature;Note=note",
forced_root_block : "p",
file_browser_callback : "simplebrowser_browse",
document_base_url : ip.baseUrl,
remove_script_host : false,
relative_urls : false,
convert_urls : true,
paste_auto_cleanup_on_paste : true,
paste_retain_style_properties : "",
paste_strip_class_attributes : true,
paste_remove_spans : false,
paste_remove_styles : true,
paste_convert_middot_lists : true,
paste_text_use_dialog : true,
};ipTinyMceConfigTable = {
// Location of TinyMCE script
script_url : ip.baseUrl + ip.libraryDir + 'js/tiny_mce/tiny_mce.js',
language: 'sl',
theme : "advanced",
plugins : "paste,inlinepopups,iplink,table",
entity_encoding : "raw",
theme_advanced_buttons1 : "copy,paste,pastetext,separator,justifyleft,justifycenter,justifyright,separator,undo,redo,separator",
theme_advanced_buttons2 : "bold,italic,underline,styleselect",
theme_advanced_buttons3 : "bullist,numlist,outdent,indent,link,unlink,sub,sup",
theme_advanced_buttons4 : "tablecontrols",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
valid_elements : "@[class|style],strong,em,br,sup,sub,p,span,b,u,i,a[name|href|target|title],ul,ol,li,table,tbody,thead,th,tr,td[colspan|rowspan]",
height : 300,
width : '100%',
content_css : ip.baseUrl + ip.themeDir + ip.theme + "/ip_content.css",
theme_advanced_styles : "Text=;Caption=caption;Signature=signature;Note=note",
forced_root_block : "p",
document_base_url : ip.baseUrl,
remove_script_host : false,
relative_urls : false,
convert_urls : true,
paste_auto_cleanup_on_paste : true,
paste_retain_style_properties : "",
paste_strip_class_attributes : true,
paste_remove_spans : false,
paste_remove_styles : true,
paste_convert_middot_lists : true,
paste_text_use_dialog : true,
paste_preprocess : function(pl, o) {
console.log(pl);
console.log(o);
ipTinyMceConfigPastePreprocess(pl, o, new Array('caption', 'signature', 'note'));
}
};